package com.fjwt.gz.core.model;

import com.alibaba.fastjson2.JSON;
import lombok.Data;

@Data
public class DBOSSConfig {

    private String ossUseType;
    private String aliyunOssConfig;

    private AliyunOssConfigModel aliyunOssConfigModel;

    public AliyunOssConfigModel getAliyunOssConfigModel(){
        if(aliyunOssConfigModel != null){
            return aliyunOssConfigModel;
        }

        AliyunOssConfigModel parseObject = JSON.parseObject(this.aliyunOssConfig, AliyunOssConfigModel.class);
        this.aliyunOssConfigModel = parseObject;
        return parseObject;
    }

    @Data
    public static class AliyunOssConfigModel{
        private String endpoint;
        private String publicBucketName;
        private String privateBucketName;
        private String accessKeyId;
        private String accessKeySecret;
        private Long expireTime;
    }

}

